/**
 * 课表组件样式
 * @description 课表相关组件的样式定义
 */

/* 课表视图容器样式 */
.schedule-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--color-bg-primary);
}

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border-secondary);
  background-color: var(--color-bg-secondary);
}

.schedule-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

.schedule-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.schedule-content {
  flex: 1;
  overflow: auto;
  padding: var(--spacing-md);
}

/* 每日课表视图样式 */
.daily-schedule {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.daily-schedule-date {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  text-align: center;
  padding: var(--spacing-md);
  background-color: var(--color-bg-secondary);
  border-radius: var(--border-radius-lg);
  margin-bottom: var(--spacing-md);
}

.daily-schedule-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.timeline-slot {
  display: flex;
  align-items: stretch;
  min-height: 60px;
  border-bottom: 1px solid var(--color-border-tertiary);
}

.timeline-time {
  width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  background-color: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border-tertiary);
}

.timeline-content {
  flex: 1;
  display: flex;
  align-items: center;
  padding: var(--spacing-sm);
}

/* 周历视图样式 */
.weekly-calendar {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.weekly-header {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  border-bottom: 1px solid var(--color-border-secondary);
  background-color: var(--color-bg-secondary);
}

.weekly-header-cell {
  padding: var(--spacing-sm);
  text-align: center;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  border-right: 1px solid var(--color-border-tertiary);
}

.weekly-header-cell:last-child {
  border-right: none;
}

.weekly-body {
  flex: 1;
  overflow: auto;
}

.weekly-row {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  min-height: 60px;
  border-bottom: 1px solid var(--color-border-tertiary);
}

.weekly-time-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  background-color: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border-tertiary);
}

.weekly-day-cell {
  position: relative;
  border-right: 1px solid var(--color-border-tertiary);
  padding: var(--spacing-xs);
}

.weekly-day-cell:last-child {
  border-right: none;
}

/* 课程实例卡片样式 */
.schedule-instance-card {
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.schedule-instance-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.schedule-instance-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--color-primary);
}

/* 课程实例卡片颜色变体 */
.schedule-instance-card.color-1::before { background-color: var(--course-color-1); }
.schedule-instance-card.color-2::before { background-color: var(--course-color-2); }
.schedule-instance-card.color-3::before { background-color: var(--course-color-3); }
.schedule-instance-card.color-4::before { background-color: var(--course-color-4); }
.schedule-instance-card.color-5::before { background-color: var(--course-color-5); }
.schedule-instance-card.color-6::before { background-color: var(--course-color-6); }
.schedule-instance-card.color-7::before { background-color: var(--course-color-7); }
.schedule-instance-card.color-8::before { background-color: var(--course-color-8); }
.schedule-instance-card.color-9::before { background-color: var(--course-color-9); }
.schedule-instance-card.color-10::before { background-color: var(--course-color-10); }

.schedule-instance-card.color-1 { background: linear-gradient(135deg, rgba(24, 144, 255, 0.05) 0%, transparent 100%); }
.schedule-instance-card.color-2 { background: linear-gradient(135deg, rgba(82, 196, 26, 0.05) 0%, transparent 100%); }
.schedule-instance-card.color-3 { background: linear-gradient(135deg, rgba(250, 173, 20, 0.05) 0%, transparent 100%); }
.schedule-instance-card.color-4 { background: linear-gradient(135deg, rgba(245, 34, 45, 0.05) 0%, transparent 100%); }
.schedule-instance-card.color-5 { background: linear-gradient(135deg, rgba(114, 46, 209, 0.05) 0%, transparent 100%); }
.schedule-instance-card.color-6 { background: linear-gradient(135deg, rgba(19, 194, 194, 0.05) 0%, transparent 100%); }
.schedule-instance-card.color-7 { background: linear-gradient(135deg, rgba(235, 47, 150, 0.05) 0%, transparent 100%); }
.schedule-instance-card.color-8 { background: linear-gradient(135deg, rgba(250, 140, 22, 0.05) 0%, transparent 100%); }
.schedule-instance-card.color-9 { background: linear-gradient(135deg, rgba(160, 217, 17, 0.05) 0%, transparent 100%); }
.schedule-instance-card.color-10 { background: linear-gradient(135deg, rgba(47, 84, 235, 0.05) 0%, transparent 100%); }

.schedule-instance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-xs);
}

.schedule-instance-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

.schedule-instance-time {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.schedule-instance-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.schedule-instance-info {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  display: flex;
  align-items: center;
}

.schedule-instance-info-icon {
  margin-right: 4px;
}

.schedule-instance-actions {
  position: absolute;
  top: var(--spacing-xs);
  right: var(--spacing-xs);
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: var(--transition-fast);
}

.schedule-instance-card:hover .schedule-instance-actions {
  opacity: 1;
}

.schedule-instance-action {
  width: 20px;
  height: 20px;
  border: none;
  background-color: rgba(0, 0, 0, 0.1);
  color: var(--color-text-secondary);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: var(--transition-fast);
}

.schedule-instance-action:hover {
  background-color: var(--color-primary);
  color: #ffffff;
}

/* 课程模板表单样式 */
.schedule-template-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
}

.schedule-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

.schedule-form-full {
  grid-column: 1 / -1;
}

.schedule-time-picker {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.schedule-time-separator {
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
}

.schedule-repeat-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-xs);
}

.schedule-day-option {
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border-primary);
  border-radius: 50%;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  transition: var(--transition-fast);
}

.schedule-day-option:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.schedule-day-option.selected {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* 冲突检测对话框样式 */
.schedule-conflict-dialog {
  max-width: 600px;
}

.conflict-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin: var(--spacing-md) 0;
}

.conflict-item {
  padding: var(--spacing-sm);
  background-color: rgba(255, 77, 79, 0.1);
  border: 1px solid rgba(255, 77, 79, 0.3);
  border-radius: var(--border-radius-md);
}

.conflict-title {
  font-weight: var(--font-weight-semibold);
  color: var(--color-error);
  margin-bottom: var(--spacing-xs);
}

.conflict-details {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.conflict-resolution {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.conflict-option {
  padding: var(--spacing-sm);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--border-radius-md);
  background-color: var(--color-bg-primary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.conflict-option:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
}

.conflict-option.selected {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
}

/* 混合课表视图样式 */
.mixed-schedule-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.mixed-schedule-students {
  display: flex;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border-secondary);
  background-color: var(--color-bg-secondary);
  overflow-x: auto;
}

.student-selector {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--border-radius-md);
  background-color: var(--color-bg-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.student-selector:hover {
  border-color: var(--color-primary);
}

.student-selector.selected {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.student-color-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: var(--spacing-xs);
}

.mixed-schedule-content {
  flex: 1;
  overflow: auto;
}

.mixed-schedule-timeline {
  display: flex;
  flex-direction: column;
}

.mixed-timeline-slot {
  display: flex;
  align-items: stretch;
  min-height: 80px;
  border-bottom: 1px solid var(--color-border-tertiary);
}

.mixed-timeline-time {
  width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  background-color: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border-tertiary);
}

.mixed-timeline-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--spacing-xs);
  gap: var(--spacing-xs);
}

.mixed-schedule-instance {
  padding: var(--spacing-xs);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-xs);
  border-left: 3px solid;
  background-color: rgba(255, 255, 255, 0.8);
}

/* 响应式表格样式 */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--color-bg-primary);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.schedule-table th,
.schedule-table td {
  padding: var(--spacing-sm);
  text-align: left;
  border-bottom: 1px solid var(--color-border-tertiary);
}

.schedule-table th {
  background-color: var(--color-bg-secondary);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.schedule-table tr:hover {
  background-color: var(--color-bg-tertiary);
}

.schedule-table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.schedule-list-item {
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  padding: var(--spacing-md);
  transition: var(--transition-fast);
}

.schedule-list-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.schedule-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.schedule-list-title {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.schedule-list-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.schedule-list-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-sm);
}

.schedule-list-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.schedule-list-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  font-weight: var(--font-weight-medium);
}

.schedule-list-value {
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .schedule-header {
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: stretch;
  }
  
  .schedule-controls {
    justify-content: space-between;
    flex-wrap: wrap;
  }
  
  .schedule-controls button {
    min-height: 44px;
    touch-action: manipulation;
  }
  
  .weekly-header,
  .weekly-row {
    grid-template-columns: 60px repeat(7, 1fr);
  }
  
  .weekly-header-cell,
  .weekly-time-cell {
    font-size: var(--font-size-xs);
    padding: var(--spacing-xs);
  }
  
  .schedule-form-row {
    grid-template-columns: 1fr;
  }
  
  .schedule-time-picker {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-sm);
  }
  
  .schedule-time-picker input {
    font-size: 16px; /* 防止 iOS 缩放 */
    min-height: 44px;
  }
  
  .mixed-schedule-students {
    flex-direction: column;
  }
  
  .student-selector {
    justify-content: center;
    min-height: 44px;
  }
  
  /* 移动端课表滑动 */
  .schedule-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .daily-schedule-timeline {
    min-width: 100%;
  }
  
  /* 移动端课程实例卡片 */
  .schedule-instance-card {
    padding: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
  }
  
  .schedule-instance-title {
    font-size: var(--font-size-xs);
  }
  
  .schedule-instance-time,
  .schedule-instance-info {
    font-size: 10px;
  }
  
  /* 移动端表格响应式 */
  .schedule-table-responsive {
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
  }
  
  .schedule-table th,
  .schedule-table td {
    padding: var(--spacing-xs);
    font-size: var(--font-size-sm);
  }
  
  .schedule-list-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .weekly-header,
  .weekly-row {
    grid-template-columns: 50px repeat(7, 1fr);
  }
  
  .weekly-header-cell {
    writing-mode: vertical-rl;
    text-orientation: mixed;
  }
  
  .schedule-instance-card {
    padding: 4px;
  }
  
  .schedule-instance-title {
    font-size: 10px;
  }
  
  .schedule-instance-time,
  .schedule-instance-info {
    font-size: 9px;
  }
  
  .timeline-time,
  .weekly-time-cell,
  .mixed-timeline-time {
    width: 50px;
    font-size: 10px;
  }
}

/* 打印样式 */
@media print {
  .schedule-controls,
  .schedule-instance-actions {
    display: none !important;
  }
  
  .schedule-view {
    height: auto !important;
  }
  
  .schedule-content,
  .weekly-body,
  .mixed-schedule-content {
    overflow: visible !important;
  }
  
  .schedule-instance-card {
    break-inside: avoid;
    border: 1px solid #000 !important;
    box-shadow: none !important;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .schedule-instance-card {
    border-width: 2px;
  }
  
  .timeline-slot,
  .weekly-row {
    border-bottom-width: 2px;
  }
  
  .schedule-day-option {
    border-width: 2px;
  }
}

/* 动画效果 */
.schedule-instance-enter {
  animation: scheduleInstanceEnter 0.3s ease-out;
}

.schedule-view-transition {
  animation: scheduleViewTransition 0.3s ease-out;
}

@keyframes scheduleInstanceEnter {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scheduleViewTransition {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
  .schedule-instance-enter,
  .schedule-view-transition {
    animation: none;
  }
  
  .schedule-instance-card:hover {
    transform: none;
  }
}